<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>用户骑行记录表</title>
    <link rel="stylesheet" href="../layui/css/layui.css">
</head>

<body>
<div class="layui-container">
    <div style="text-align: center;margin-bottom: 15px"><p1 style="font-size:28px;">用户骑行记录表</p1><div/>
    <table class="layui-table">
        <thead>
        <tr>
            <th style="text-align: center">用户ID</th>
<!--            <th style="text-align: center">username</th>-->
            <th style="text-align: center">单车ID</th>
            <th style="text-align: center">开始时间</th>
            <th style="text-align: center">结束时间</th>
            <th style="text-align: center">距离</th>
            <th style="text-align: center">费用</th>
        </tr>
        </thead>
        <tbody id="tableBody">
        </tbody>
    </table>
</div>

<script src="../layui/layui.js"></script>
<script src="../js/public.js"></script>
<script>
    layui.use(['form', 'layer', 'table'], function () {
        var table = layui.table
            , form = layui.form, $ = layui.$;
        var geturl = url + user.allRideMsg;
        var element = layui.element;
        var $ = layui.jquery;

        $.ajax({
            type: "POST",
            url: geturl,
            data: JSON,
            contentType: 'application/json',
            success: function (data) {
                console.log(data)
                var tableBody = $('#tableBody');
                data.data.forEach(function (item) {
                        var row = '<tr>' +
                            '<td>' + item.userID + '</td>' +
                            // '<td>' + item.username + '</td>' +
                            '<td>' + item.bicycleID + '</td>' +
                            '<td>' + item.startTime + '</td>' +
                            '<td>' + item.endTime + '</td>' +
                            '<td>' + item.distance + '</td>' +
                            '<td>' + item.cost + '</td>' +
                            '</tr>';
                        tableBody.append(row);
                    });
                }
        });
    });
</script>
</body>

</html>
